<?php  namespace app\common\service;
use \app\common\model\UserIntegral as UserIntegralModel;
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/26
 * Time: 1:43
 */
class UserIntegral extends Base {
    public function __construct()
    {
        $this->model = new UserIntegralModel();
    }
    public function getMyUserIntegral($where,$limit,$page){
        $data['total'] = $this->model->where($where)->sum('integral');
        $data['list'] = $this->model->where($where)
            ->limit($limit)
            ->page($page)
            ->field('id,integral,type,createtime')
            ->order('createtime desc')->select();
        if(empty($data['list'])){
            $res['msg']="暂无数据";
            $res['data']=[];
            $res['code']=0;
        }else{
            $res['msg']="请求数据正常";
            $res['data']=$data;
            $res['code']=1;
        }
        return $res;
    }
}